<!DOCTYPE html>
<html lang="en-us">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    
<meta charset="UTF-8">
<title>HTTP input | Elasticsearch Guide [7.7] | Elastic</title>
<link rel="home" href="index.html" title="Elasticsearch Guide [7.7]">
<link rel="up" href="input.html" title="Inputs">
<link rel="prev" href="input-search.html" title="Search input">
<link rel="next" href="input-chain.html" title="Chain input">
<meta name="DC.type" content="Learn/Docs/Elasticsearch/Reference/7.7">
<meta name="DC.subject" content="Elasticsearch">
<meta name="DC.identifier" content="7.7">
<meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.optimizely.com/js/18132920325.js"></script>
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
    <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="/manifest.json">
    <meta name="apple-mobile-web-app-title" content="Elastic">
    <meta name="application-name" content="Elastic">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/mstile-144x144.png">
    <meta name="theme-color" content="#ffffff">
    <meta name="naver-site-verification" content="936882c1853b701b3cef3721758d80535413dbfd">
    <meta name="yandex-verification" content="d8a47e95d0972434">
    <meta name="localized" content="true">
    <meta name="st:robots" content="follow,index">
    <meta property="og:image" content="https://www.elastic.co/static/images/elastic-logo-200.png">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon-precomposed" sizes="64x64" href="/favicon_64x64_16bit.png">
    <link rel="apple-touch-icon-precomposed" sizes="32x32" href="/favicon_32x32.png">
    <link rel="apple-touch-icon-precomposed" sizes="16x16" href="/favicon_16x16.png">
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/guide/static/styles.css">
  </head>

  <!--© 2015-2021 Elasticsearch B.V. Copying, publishing and/or distributing without written permission is strictly prohibited.-->

  <body>
    <!-- Google Tag Manager -->
    <script>dataLayer = [];</script><noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-58RLH5" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-58RLH5');</script>
    <!-- End Google Tag Manager -->

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-12395217-16"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-12395217-16');
    </script>

    <!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET-->
    <script type="text/javascript">
      (function(){var g=function(e,h,f,g){
      this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
      this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};
      this.check=function(){var a=this.get(f);if(a)a=a.split(":");else if(100!=e)"v"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(":"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
      this.go=function(){if(this.check()){var a=document.createElement("script");a.type="text/javascript";a.src=g;document.body&&document.body.appendChild(a)}};
      this.start=function(){var a=this;window.addEventListener?window.addEventListener("load",function(){a.go()},!1):window.attachEvent&&window.attachEvent("onload",function(){a.go()})}};
      try{(new g(100,"r","QSI_S_ZN_emkP0oSe9Qrn7kF","https://znemkp0ose9qrn7kf-elastic.siteintercept.qualtrics.com/WRSiteInterceptEngine/?Q_ZID=ZN_emkP0oSe9Qrn7kF")).start()}catch(i){}})();
    </script><div id="ZN_emkP0oSe9Qrn7kF"><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
    <!--END WEBSITE FEEDBACK SNIPPET-->

    <div id="elastic-nav" style="display:none;"></div>
    <script src="https://www.elastic.co/elastic-nav.js"></script>

    <!-- Subnav -->
    <div>
      <div>
        <div class="tertiary-nav d-none d-md-block">
          <div class="container">
            <div class="p-t-b-15 d-flex justify-content-between nav-container">
              <div class="breadcrum-wrapper"><span><a href="/guide/" style="font-size: 14px; font-weight: 600; color: #000;">Docs</a></span></div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="main-container">
      <section id="content">
        <div class="content-wrapper">

          <section id="guide" lang="en">
            <div class="container">
              <div class="row">
                <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                  <!-- start body -->
                  <div class="page_header">
<strong>IMPORTANT</strong>: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
<a href="../current/index.html">current release documentation</a>.
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="xpack-alerting.html">Alerting on cluster and index events</a></span>
»
<span class="breadcrumb-link"><a href="input.html">Inputs</a></span>
»
<span class="breadcrumb-node">HTTP input</span>
</div>
<div class="navheader">
<span class="prev">
<a href="input-search.html">« Search input</a>
</span>
<span class="next">
<a href="input-chain.html">Chain input »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="input-http"></a>HTTP input<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a><a class="xpack_tag" href="/subscriptions"></a>
</h2>
</div></div></div>
<p>Use the <code class="literal">http</code> input to submit a request to an HTTP endpoint and load the
response into the watch execution context when the watch is triggered. See
<a class="xref" href="input-http.html#http-input-attributes" title="HTTP input attributes">HTTP input attributes</a> for all of the supported attributes.</p>
<p>With the <code class="literal">http</code> input, you can:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
Query external Elasticsearch clusters. The <code class="literal">http</code> input provides a way
to submit search requests to clusters other than the one Watcher is running
on. This is useful when you’re running a dedicated Watcher cluster or if you
need to search clusters that are running different Elasticsearch versions.
</li>
<li class="listitem">
Query Elasticsearch APIs other than the search API. For example, you might want
to load data from the <a class="xref" href="cluster-nodes-stats.html" title="Nodes stats API">nodes stats</a>,
<a class="xref" href="cluster-health.html" title="Cluster health API">cluster health</a> or <a class="xref" href="cluster-state.html" title="Cluster state API">cluster state</a> APIs.
</li>
<li class="listitem">
Query external web services. The <code class="literal">http</code> input enables you to load data from
any service that exposes an HTTP endpoint. This provides a bridge
between Elasticsearch clusters and other systems.
</li>
</ul>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_querying_external_elasticsearch_clusters"></a>Querying external Elasticsearch clusters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<p>To query an external Elasticsearch cluster, you specify the cluster’s
<code class="literal">host</code> and <code class="literal">port</code> attributes and the index’s search endpoint as the <code class="literal">path</code>.
If you omit the search body, the request returns all documents in the specified
index:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "host" : "example.com",
      "port" : 9200,
      "path" : "/idx/_search"
    }
  }
}</pre>
</div>
<p>You can use the full Elasticsearch <a class="xref" href="query-dsl.html" title="Query DSL">query DSL</a> to perform
more sophisticated searches. For example, the following <code class="literal">http</code> input retrieves
all documents that contain <code class="literal">event</code> in the <code class="literal">category</code> field:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "host" : "host.domain",
      "port" : 9200,
      "path" : "/idx/_search",
      "body" :  "{\"query\" :  {  \"match\" : { \"category\" : \"event\"}}}"
    }
  }
}</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_calling_elasticsearch_apis"></a>Calling Elasticsearch APIs<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<p>To load the data from other Elasticsearch APIs, specify the API
endpoint as the <code class="literal">path</code> attribute. Use the <code class="literal">params</code> attribute to specify
query string parameters. For example, the following <code class="literal">http</code> input
calls the <a class="xref" href="cluster-stats.html" title="Cluster stats API">cluster stats</a> API and enables the <code class="literal">human</code> attribute:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "host" : "host.domain",
      "port" : 9200,
      "path" : "/_cluster/stats",
      "params" : {
        "human" : "true" <a id="CO509-1"></a><i class="conum" data-value="1"></i>
      }
    }
  }
}</pre>
</div>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO509-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>Enabling this attribute returns the <code class="literal">bytes</code> values in the response in human
readable format.</p>
</td>
</tr>
</table>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="input-http-auth-basic-example"></a>Calling external web services<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<p>You can use <code class="literal">http</code> input to get data from any external web service. The <code class="literal">http</code>
input supports basic authentication. For example, the following input provides
a username and password to access <code class="literal">myservice</code>:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "host" : "host.domain",
      "port" : 9200,
      "path" : "/myservice",
      "auth" : {
        "basic" : {
          "username" : "user",
          "password" : "pass"
        }
      }
    }
  }
}</pre>
</div>
<p>You can also pass in service-specific API keys and other information
through the <code class="literal">params</code> attribute. For example, the following <code class="literal">http</code>
input loads the current weather forecast for Amsterdam from the
<a href="http://openweathermap.org/appid" class="ulink" target="_top">OpenWeatherMap</a> service:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "url" : "http://api.openweathermap.org/data/2.5/weather",
      "params" : {
        "lat" : "52.374031",
        "lon" : "4.88969",
        "appid" : "&lt;your openweathermap appid&gt;"
      }
    }
  }
}</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_using_templates_2"></a>Using templates<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<p>The <code class="literal">http</code> input supports templating. You can use <a class="xref" href="how-watcher-works.html#templates" title="Using templates">templates</a> when
specifying the <code class="literal">path</code>, <code class="literal">body</code>, header values, and parameter values.</p>
<p>For example, the following snippet uses templates to specify what index to query
and restrict the results to documents added within the last five minutes:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">"input" : {
  "http" : {
    "request" : {
      "host" : "host.domain",
      "port" : 9200,
      "path" : "/{{ctx.watch_id}}/_search",
      "body" : "{\"query\" : {\"range\": {\"@timestamp\" : {\"from\": \"{{ctx.trigger.triggered_time}}||-5m\",\"to\": \"{{ctx.trigger.triggered_time}}\"}}}}"
      }
    }
  }</pre>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="_accessing_the_http_response"></a>Accessing the HTTP response<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<p>If the response body is formatted in  JSON or YAML, it is parsed and loaded into
the execution context. If the response body is not formatted in JSON or YAML, it
is loaded into the payload’s <code class="literal">_value</code> field.</p>
<p>Conditions, transforms, and actions access the response data through the
execution context. For example, if the response contains a <code class="literal">message</code>
object, you can use <code class="literal">ctx.payload.message</code> to access the message data.</p>
<p>In addition all the headers from the response can be accessed using the
<code class="literal">ctx.payload._headers</code> field as well as the HTTP status code of the response using
<code class="literal">ctx.payload._status_code</code>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="http-input-attributes"></a>HTTP input attributes<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/x-pack/docs/en/watcher/input/http.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="informaltable">
<table border="1" cellpadding="4px">
<colgroup>
<col class="col_1">
<col class="col_2">
<col class="col_3">
<col class="col_4">
</colgroup>
<thead>
<tr>
<th align="left" valign="top">Name</th>
<th align="center" valign="top">Required</th>
<th align="center" valign="top">Default</th>
<th align="left" valign="top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p><code class="literal">request.scheme</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>http</p></td>
<td align="left" valign="top"><p>Url scheme. Valid values are: <code class="literal">http</code> or <code class="literal">https</code>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.host</code></p></td>
<td align="center" valign="top"><p>yes</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The host to connect to.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.port</code></p></td>
<td align="center" valign="top"><p>yes</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The port the http service is listening on.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.path</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The URL path. The path can be static text or contain <code class="literal">mustache</code>
                                                       <a class="xref" href="how-watcher-works.html#templates" title="Using templates">templates</a>. URL query string parameters must be
                                                       specified via the <code class="literal">request.params</code> attribute.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.method</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>get</p></td>
<td align="left" valign="top"><p>The HTTP method. Supported values are: <code class="literal">head</code>, <code class="literal">get</code>, <code class="literal">post</code>,
                                                       <code class="literal">put</code> and <code class="literal">delete</code>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.headers</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The HTTP request headers. The header values can be static text
                                                       or include <code class="literal">mustache</code> <a class="xref" href="how-watcher-works.html#templates" title="Using templates">templates</a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.params</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The URL query string parameters. The parameter values can be
                                                       static text or contain <code class="literal">mustache</code> <a class="xref" href="how-watcher-works.html#templates" title="Using templates">templates</a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.url</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>Allows you to set <code class="literal">request.scheme</code>, <code class="literal">request.host</code>, <code class="literal">request.port</code>
                                                       and <code class="literal">request.params</code> add once by specifying a real URL, like
                                                       <code class="literal">https://www.example.org:1234/mypath?foo=bar</code>. May not be combined
                                                       with on of those four parameters. As those parameters are set,
                                                       specifying them individually might overwrite them.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.auth.basic.username</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>HTTP basic authentication username</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.auth.basic.password</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>HTTP basic authentication password</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.proxy.host</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The proxy host to use when connecting to the host.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.proxy.port</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The proxy port to use when connecting to the host.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.connection_timeout</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>10s</p></td>
<td align="left" valign="top"><p>The timeout for setting up the http connection. If the connection
                                                       could not be set up within this time, the input will timeout and
                                                       fail.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.read_timeout</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>10s</p></td>
<td align="left" valign="top"><p>The timeout for reading data from http connection. If no response
                                                       was received within this time, the input will timeout and fail.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">request.body</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>The HTTP request body. The body can be static text or include
                                                       <code class="literal">mustache</code> <a class="xref" href="how-watcher-works.html#templates" title="Using templates">templates</a>.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">extract</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>-</p></td>
<td align="left" valign="top"><p>A array of JSON keys to extract from the input response and
                                                       use as payload. In cases when an input generates a large
                                                       response this can be used to filter the relevant piece of
                                                       the response to be used as payload.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">response_content_type</code></p></td>
<td align="center" valign="top"><p>no</p></td>
<td align="center" valign="top"><p>json</p></td>
<td align="left" valign="top"><p>The expected content type the response body will contain.
                                                       Supported values are <code class="literal">json</code>, <code class="literal">yaml</code> and <code class="literal">text</code>. If the
                                                       format is <code class="literal">text</code> the <code class="literal">extract</code> attribute cannot exist.
                                                       Note that this overrides the header that is returned in the
                                                       HTTP response. If this is set to <code class="literal">text</code> the body of the
                                                       response will be assigned and accessible to/via the <code class="literal">_value</code>
                                                       variable of the payload.</p></td>
</tr>
</tbody>
</table>
</div>
<p>You can reference the following variables in the execution context when
specifying the <code class="literal">path</code>, <code class="literal">params</code>, <code class="literal">headers</code> and <code class="literal">body</code> values:</p>
<div class="informaltable">
<table border="1" cellpadding="4px">
<colgroup>
<col class="col_1">
<col class="col_2">
</colgroup>
<thead>
<tr>
<th align="left" valign="top">Name</th>
<th align="left" valign="top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" valign="top"><p><code class="literal">ctx.watch_id</code></p></td>
<td align="left" valign="top"><p>The id of the watch that is currently executing.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ctx.execution_time</code></p></td>
<td align="left" valign="top"><p>The time execution of this watch started.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ctx.trigger.triggered_time</code></p></td>
<td align="left" valign="top"><p>The time this watch was triggered.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ctx.trigger.scheduled_time</code></p></td>
<td align="left" valign="top"><p>The time this watch was supposed to be triggered.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p><code class="literal">ctx.metadata.*</code></p></td>
<td align="left" valign="top"><p>Any metadata associated with the watch.</p></td>
</tr>
</tbody>
</table>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="input-search.html">« Search input</a>
</span>
<span class="next">
<a href="input-chain.html">Chain input »</a>
</span>
</div>
</div>

                  <!-- end body -->
                </div>
                <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                  <div id="rtpcontainer" style="display: block;">
                    <div class="mktg-promo">
                      <h3>Most Popular</h3>
                      <ul class="icons">
                        <li class="icon-elasticsearch-white"><a href="https://www.elastic.co/webinars/getting-started-elasticsearch?baymax=default&amp;elektra=docs&amp;storm=top-video">Get Started with Elasticsearch: Video</a></li>
                        <li class="icon-kibana-white"><a href="https://www.elastic.co/webinars/getting-started-kibana?baymax=default&amp;elektra=docs&amp;storm=top-video">Intro to Kibana: Video</a></li>
                        <li class="icon-logstash-white"><a href="https://www.elastic.co/webinars/introduction-elk-stack?baymax=default&amp;elektra=docs&amp;storm=top-video">ELK for Logs &amp; Metrics: Video</a></li>
                      </ul>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </section>

        </div>


<div id="elastic-footer"></div>
<script src="https://www.elastic.co/elastic-footer.js"></script>
<!-- Footer Section end-->

      </section>
    </div>

<script src="/guide/static/jquery.js"></script>
<script type="text/javascript" src="/guide/static/docs.js"></script>
<script type="text/javascript">
  window.initial_state = {}</script>
  </body>
</html>
